const mongoose = require('../config/db/mongo');
const moment = require('moment');
const Schema = mongoose.Schema;
const schemaOptions = {
    versionKey: false
}
/**
 *
 *    Role 所有用户都有一个Role 根据Role不同给予不同的权限
 *
 */
const authoritySchema = new Schema({

    //角色名称
    name: String,
    //权限路径
    path: [String],
    //创建时间
    isDelete: Number,
    createdAt: {type: Date,default: Date.now},updatedAt: {type: Date},
}, schemaOptions);


// methods ====================== 提高数据库检索速度 按顺序
authoritySchema.index({name: 1});

// create the model for users and expose it to our app
module.exports = mongoose.model('authority', authoritySchema, 'authority');
